﻿
function ValSumbit() {
    var cntlname = "ctl00_ContentPlaceHolder1_";
    var enableSend = true;

    var elems = document.getElementsByTagName('input');
    for (var i = 0; i < elems.length; i++) {
        elems[i].style.backgroundColor = "white";
    }


    if (document.getElementById(cntlname + 'txtPrjName').value == "") {
        alert("Project Name is Required");
        document.getElementById(cntlname + 'txtPrjName').focus();
        document.getElementById(cntlname + 'txtPrjName').style.backgroundColor = "red";
        enableSend = false;
    }

    if (document.getElementById(cntlname + 'txtTargetPath').value == "") {
        alert("Target path is Required");
        document.getElementById(cntlname + 'txtTargetPath').focus();
        document.getElementById(cntlname + 'txtTargetPath').style.backgroundColor = "red";
        enableSend = false;
    }


    if (document.getElementById(cntlname + 'txtdrives').value != "") {

        if (document.getElementById(cntlname + 'txtTargetPath').value != "") {

            var textdrives = document.getElementById(cntlname + 'txtdrives').value;
            var text = document.getElementById(cntlname + 'txtTargetPath').value;
            var dname = text.slice(0, text.indexOf("\:"));
            var driveName = dname + "\:";
            var driveName = driveName.toUpperCase();
            if (driveName != "") {
                var index = textdrives.indexOf(driveName);

                if (index == -1) {
                    alert('Given target drive is not available');
                    document.getElementById(cntlname + 'txtTargetPath').focus();
                    document.getElementById(cntlname + 'txtTargetPath').style.backgroundColor = "red";
                    enableSend = false;
                }
            }
        }
    }



    if (document.getElementById(cntlname + 'txtBldTimeout').value == "") {
        alert("Build timeout is Required");
        document.getElementById(cntlname + 'txtBldTimeout').focus();
        document.getElementById(cntlname + 'txtBldTimeout').style.backgroundColor = "red";
        enableSend = false;
    }
    if (document.getElementById(cntlname + 'txtBldConfig').value == "") {
        alert("Build Configuration is Required");
        document.getElementById(cntlname + 'txtBldConfig').focus();
        document.getElementById(cntlname + 'txtBldConfig').style.backgroundColor = "red";
        enableSend = false;
    }

    if (document.getElementById(cntlname + 'txtSlnFle').value == "") {
        alert("Solution file name is Required");
        document.getElementById(cntlname + 'txtSlnFle').focus();
        document.getElementById(cntlname + 'txtSlnFle').style.backgroundColor = "red";
        enableSend = false;
    }

    // Source Type SVN section controls - validation

    var ddlName = document.getElementById(cntlname + 'ddlSourceType');
    var ddlValue = ddlName.options[ddlName.selectedIndex].value;
    if (ddlValue == '0') {

        if (document.getElementById(cntlname + 'txtTrunkUri').value == "") {
            alert("TrucnkURI Can't be Empty");
            document.getElementById(cntlname + 'txtTrunkUri').focus();
            document.getElementById(cntlname + 'txtTrunkUri').style.backgroundColor = "red";
            enableSend = false;
        }
        

        //if (document.getElementById(cntlname + 'ddlSourceType').selectedIndex == 0) {
            if (document.getElementById(cntlname + 'txtTrunkUri').value != "") {
                if (isUrl(document.getElementById(cntlname + 'txtTrunkUri').value) == false) {
                    alert("SVN trunk URI is wrong");
                    document.getElementById(cntlname + 'txtTrunkUri').focus();
                    document.getElementById(cntlname + 'txtTrunkUri').style.backgroundColor = "red";
                    enableSend = false;
                }

            }
        //}

        if (document.getElementById(cntlname + 'txtUser').value == "") {
            alert("Username is Required");
            document.getElementById(cntlname + 'txtUser').focus();
            document.getElementById(cntlname + 'txtUser').style.backgroundColor = "red";
            enableSend = false;
        }

        if (document.getElementById(cntlname + 'txtPassword').value == "") {
            alert("Password Can't be Empty");
            document.getElementById(cntlname + 'txtPassword').focus();
            document.getElementById(cntlname + 'txtPassword').style.backgroundColor = "red";
            enableSend = false;
        }

        if (document.getElementById(cntlname + 'txtTimeOut').value == "") {
            alert("Timeout Can't be Empty");
            document.getElementById(cntlname + 'txtTimeOut').focus();
            document.getElementById(cntlname + 'txtTimeOut').style.backgroundColor = "red";
            enableSend = false;
        }

       // if (document.getElementById(cntlname + 'ddlSourceType').selectedIndex == 0) {
            if (document.getElementById(cntlname + 'txtBseURI').value != "") {
                if (isUrl(document.getElementById(cntlname + 'txtBseURI').value) == false) {
                    alert("Tage base URI is wrong");
                    document.getElementById(cntlname + 'txtBseURI').focus();
                    document.getElementById(cntlname + 'txtBseURI').style.backgroundColor = "red";
                    enableSend = false;
                }
            }
        //}
        
    }

    // Source Type VSTS section controls - validation
    if (ddlValue == '1') {

        if (document.getElementById(cntlname + 'txtServer').value == "") {
            alert('Server name can not be empty');
            document.getElementById(cntlname + 'txtServer').focus();
            document.getElementById(cntlname + 'txtServer').style.backgroundColor = "red";
            enableSend = false;

        }
        if (document.getElementById(cntlname + 'txtProject').value == "") {
            alert('Project can not be empty');
            document.getElementById(cntlname + 'txtProject').focus();
            document.getElementById(cntlname + 'txtProject').style.backgroundColor = "red";
            enableSend = false;

        }
        if (document.getElementById(cntlname + 'txtVSTSUser').value == "") {
            alert('Username can not be empty');
            document.getElementById(cntlname + 'txtVSTSUser').focus();
            document.getElementById(cntlname + 'txtVSTSUser').style.backgroundColor = "red";
            enableSend = false;

        }
        if (document.getElementById(cntlname + 'txtVSTSpassword').value == "") {
            alert('Password can not be empty');
            document.getElementById(cntlname + 'txtVSTSpassword').focus();
            document.getElementById(cntlname + 'txtVSTSpassword').style.backgroundColor = "red";
            enableSend = false;

        }
    }

    if (ddlValue == '2') {

        if (document.getElementById(cntlname + 'txtViewPath').value == "") {
            alert('ViewPath can not be empty');
            document.getElementById(cntlname + 'txtViewPath').focus();
            document.getElementById(cntlname + 'txtViewPath').style.backgroundColor = "red";
            enableSend = false;
        }

        if (document.getElementById(cntlname + 'txtViewPath').value != "") {
            if (FolderPathValidation(document.getElementById(cntlname + 'txtViewPath').value) == false) {
                alert('ViewPath is wrong');
                document.getElementById(cntlname + 'txtViewPath').focus();
                document.getElementById(cntlname + 'txtViewPath').style.backgroundColor = "red";
                enableSend = false;
            }
        }
        
        if (document.getElementById(cntlname + 'txtBranch').value == "") {
            alert('Branch can not be empty');
            document.getElementById(cntlname + 'txtBranch').focus();
            document.getElementById(cntlname + 'txtBranch').style.backgroundColor = "red";
            enableSend = false;
        }
        if (document.getElementById(cntlname + 'txtProjVobName').value == "") {
            alert('ProjectVobName can not be empty');
            document.getElementById(cntlname + 'txtProjVobName').focus();
            document.getElementById(cntlname + 'txtProjVobName').style.backgroundColor = "red";
            enableSend = false;
        }
        if (document.getElementById(cntlname + 'txtViewName').value == "") {
            alert('Viewname can not be empty');
            document.getElementById(cntlname + 'txtViewName').focus();
            document.getElementById(cntlname + 'txtViewName').style.backgroundColor = "red";
            enableSend = false;
        }
        if (document.getElementById(cntlname + 'txtCcTimeout').value == "") {
            alert('Time out can not be empty');
            document.getElementById(cntlname + 'txtCcTimeout').focus();
            document.getElementById(cntlname + 'txtCcTimeout').style.backgroundColor = "red";
            enableSend = false;
        }
    }

    //Pre Build script Validation
    if (document.getElementById(cntlname + 'chkPreBuild').checked == true) {
        if (document.getElementById(cntlname + 'txtPreBldFile').value == "") {
            alert("Pre Build script Filename is required");
            document.getElementById(cntlname + 'txtPreBldFile').focus();
            document.getElementById(cntlname + 'txtPreBldFile').style.backgroundColor = "red";
            enableSend = false;
        }
    }

    //build trigger validation - start
    
    if (document.getElementById(cntlname + 'ChkBldTrger').checked == true) {
    
        //Interval Trigger - Start
        
         if (document.getElementById(cntlname + 'ChkIntTrigg').checked == true)
 {

            if (document.getElementById(cntlname + 'txtBldIntrvl').value == "")
		 {
                	alert("Interval trigger interval is required");
                	document.getElementById(cntlname + 'txtBldIntrvl').focus();
                	document.getElementById(cntlname + 'txtBldIntrvl').style.backgroundColor = "red";
                	enableSend = false;
            	 }

            else 
		{

                	if (IsNumeric(document.getElementById(cntlname + 'txtBldIntrvl').value) == false) 
			{
                    		alert("Interval trigger value should be numeric");
                    		document.getElementById(cntlname + 'txtBldIntrvl').focus();
                   		document.getElementById(cntlname + 'txtBldIntrvl').style.backgroundColor = "red";
                    		enableSend = false;
               		}
            	}
}
        
        //Interval Trigger - End
        
        //Filter Trigger - Start

        if (document.getElementById(cntlname + 'chkFiltTrig').checked == true) 
{

            if (document.getElementById(cntlname + 'txtFiltStTime').value == "")
		 {
                	alert("Filter trigger start time is required");
               		document.getElementById(cntlname + 'txtFiltStTime').focus();
                	document.getElementById(cntlname + 'txtFiltStTime').style.backgroundColor = "red";
                	enableSend = false;
           	 }
            else 
		{
                	if (checktime(document.getElementById(cntlname + 'txtFiltStTime').value) == false)
			 {
                    		alert("Filter trigger start time should be in HH:MM format. Range between 00:00 and 23:59");
                    		document.getElementById(cntlname + 'txtFiltStTime').focus();
                    		document.getElementById(cntlname + 'txtFiltStTime').style.backgroundColor = "red";
                    		enableSend = false;
                	 }
           	 }
            

            if (document.getElementById(cntlname + 'txtFiltEndTime').value == "") 
		{
                	alert("Filter trigger end time is required");
                	document.getElementById(cntlname + 'txtFiltEndTime').focus();
                	document.getElementById(cntlname + 'txtFiltEndTime').style.backgroundColor = "red";
                	enableSend = false;
           	 }
            else 
		{
                	if (checktime(document.getElementById(cntlname + 'txtFiltEndTime').value) == false)
			 {
			     alert("Filter trigger end time should be in HH:MM format. Range between 00:00 and 23:59");
                   		document.getElementById(cntlname + 'txtFiltEndTime').focus();
                    		document.getElementById(cntlname + 'txtFiltEndTime').style.backgroundColor = "red";
                    		enableSend = false;
                	 }
           	}

            if (document.getElementById(cntlname + 'txtFiltDuration').value == "") 
		{
                	alert("Filter trigger duration is required");
                	document.getElementById(cntlname + 'txtFiltDuration').focus();
                	document.getElementById(cntlname + 'txtFiltDuration').style.backgroundColor = "red";
                	enableSend = false;
           	 }
            else 
		 {
                	if (IsNumeric(document.getElementById(cntlname + 'txtFiltDuration').value) == false) 
			{
                    		alert("Filter trigger duration value should be numeric");
                    		document.getElementById(cntlname + 'txtFiltDuration').focus();
                    		document.getElementById(cntlname + 'txtFiltDuration').style.backgroundColor = "red";
                    		enableSend = false;

                	}
           	 }

 }
        
        //Filter Trigger - End

        //Schedule Trigger - Start

 if (document.getElementById(cntlname + 'chkSchedTrig').checked == true) {
     if (document.getElementById(cntlname + 'txtSchedTrigTime').value == "") {
         alert("Schedule trigger time is required");
         document.getElementById(cntlname + 'txtSchedTrigTime').focus();
         document.getElementById(cntlname + 'txtSchedTrigTime').style.backgroundColor = "red";
         enableSend = false;
     }

     else {
         if (checktime(document.getElementById(cntlname + 'txtSchedTrigTime').value) == false) {
             alert("Schedule trigger time should be in HH:MM format. Range between 00:00 and 23:59");
             document.getElementById(cntlname + 'txtSchedTrigTime').focus();
             document.getElementById(cntlname + 'txtSchedTrigTime').style.backgroundColor = "red";
             enableSend = false;
         }
     }
 }
        
        //Schedule Trigger - End
        
    }

// build trigger validation - end

    //StyleCop Validation
    if ((document.getElementById(cntlname + 'txtStylecopsettings').value == "") && (document.getElementById(cntlname + 'chkStyleCop').checked == true)) {
        alert("StyleCop Settings File is required");
        document.getElementById(cntlname + 'txtStylecopsettings').focus();
        document.getElementById(cntlname + 'txtStylecopsettings').style.backgroundColor = "red";
        enableSend = false;
    }

    //Testing Validation

    //NUnit testing validation

    if (document.getElementById(cntlname + 'drpTestType').selectedIndex == 0) {
        if ((document.getElementById(cntlname + 'txtNunitEXEPath').value == "") && (document.getElementById(cntlname + 'chkNunit').checked == true) && (document.getElementById(cntlname + 'drpTestType').selectedIndex == 0)) {
            alert("NUnit BIN folder path is required");
            document.getElementById(cntlname + 'txtNunitEXEPath').focus();
            document.getElementById(cntlname + 'txtNunitEXEPath').style.backgroundColor = "red";
            enableSend = false;
        }
        if ((document.getElementById(cntlname + 'txtNunitDLLname').value == "") && (document.getElementById(cntlname + 'chkNunit').checked == true) && (document.getElementById(cntlname + 'drpTestType').selectedIndex == 0)) {
            alert("NUnit DLL name is required");
            document.getElementById(cntlname + 'txtNunitDLLname').focus();
            document.getElementById(cntlname + 'txtNunitDLLname').style.backgroundColor = "red";
            enableSend = false;
        }
        if ((document.getElementById(cntlname + 'txtNunitRptFile').value == "") && (document.getElementById(cntlname + 'chkNunit').checked == true) && (document.getElementById(cntlname + 'drpTestType').selectedIndex == 0)) {
            alert("NUnit report file name is required");
            document.getElementById(cntlname + 'txtNunitRptFile').focus();
            document.getElementById(cntlname + 'txtNunitRptFile').style.backgroundColor = "red";
            enableSend = false;
        }     
      
    }

    //MSTest testing validation

    if (document.getElementById(cntlname + 'drpTestType').selectedIndex == 1) {
        if ((document.getElementById(cntlname + 'txtmstextexe').value == "") && (document.getElementById(cntlname + 'chkNunit').checked == true) && (document.getElementById(cntlname + 'drpTestType').selectedIndex == 1)) {
            alert("MSTest EXE path is required");
            document.getElementById(cntlname + 'txtmstextexe').focus();
            document.getElementById(cntlname + 'txtmstextexe').style.backgroundColor = "red";
            enableSend = false;
        }
        if ((document.getElementById(cntlname + 'txtmstestdll').value == "") && (document.getElementById(cntlname + 'chkNunit').checked == true) && (document.getElementById(cntlname + 'drpTestType').selectedIndex == 1)) {
            alert("MSTest DLL name is required");
            document.getElementById(cntlname + 'txtmstestdll').focus();
            document.getElementById(cntlname + 'txtmstestdll').style.backgroundColor = "red";
            enableSend = false;
        }
        if ((document.getElementById(cntlname + 'txtmstestOutput').value == "") && (document.getElementById(cntlname + 'chkNunit').checked == true) && (document.getElementById(cntlname + 'drpTestType').selectedIndex == 1)) {
            alert("MSTest output file name is required");
            document.getElementById(cntlname + 'txtmstestOutput').focus();
            document.getElementById(cntlname + 'txtmstestOutput').style.backgroundColor = "red";
            enableSend = false;
        }
    }


    //NCover Validation
    if (document.getElementById(cntlname + 'ddlCodeCoverage').selectedIndex == 0) {
        if ((document.getElementById(cntlname + 'txtNCLog').value == "") && (document.getElementById(cntlname + 'chkNcover').checked == true)) {
            alert("NCover Log Filename is required");
            document.getElementById(cntlname + 'txtNCLog').focus();
            document.getElementById(cntlname + 'txtNCLog').style.backgroundColor = "red";
            enableSend = false;
        }
    }

    //FXCop Validation
    if ((document.getElementById(cntlname + 'txtFxPrjFileName').value == "") && (document.getElementById(cntlname + 'ChkFx').checked == true)) {
        alert("FxCop Project Name is required");
        document.getElementById(cntlname + 'txtFxPrjFileName').focus();
        document.getElementById(cntlname + 'txtFxPrjFileName').style.backgroundColor = "red";
        enableSend = false;
    }
    if ((document.getElementById(cntlname + 'txtFxRptFile').value == "") && (document.getElementById(cntlname + 'ChkFx').checked == true)) {
        alert("FxCop Report Filename is required");
        document.getElementById(cntlname + 'txtFxRptFile').focus();
        document.getElementById(cntlname + 'txtFxRptFile').style.backgroundColor = "red";
        enableSend = false;
    }

    //Sand Castle Validation
    if ((document.getElementById(cntlname + 'txtSand').value == "") && (document.getElementById(cntlname + 'ChkSand').checked == true)) {
        alert("Sande Castle Project Name is required");
        document.getElementById(cntlname + 'txtSand').focus();
        document.getElementById(cntlname + 'txtSand').style.backgroundColor = "red";
        enableSend = false;
    }
    if ((document.getElementById(cntlname + 'txtSandOutDir').value == "") && (document.getElementById(cntlname + 'ChkSand').checked == true)) {
        alert("Sand Castle Output Direcoty is required");
        document.getElementById(cntlname + 'txtSandOutDir').focus();
        document.getElementById(cntlname + 'txtSandOutDir').style.backgroundColor = "red";
        enableSend = false;
    }

    //NDepend Validation
    if ((document.getElementById(cntlname + 'txtNDprjFile').value == "") && (document.getElementById(cntlname + 'chkND').checked == true)) {
        alert("NDepend Project Name is required");
        document.getElementById(cntlname + 'txtNDprjFile').focus();
        document.getElementById(cntlname + 'txtNDprjFile').style.backgroundColor = "red";
        enableSend = false;
    }
    if ((document.getElementById(cntlname + 'txtNDRptDir').value == "") && (document.getElementById(cntlname + 'chkND').checked == true)) {
        alert("NDepend Report Directory is required");
        document.getElementById(cntlname + 'txtNDRptDir').focus();
        document.getElementById(cntlname + 'txtNDRptDir').style.backgroundColor = "red";
        enableSend = false;
    }

    //Database Validation
    if ((document.getElementById(cntlname + 'txtDBServer').value == "") && (document.getElementById(cntlname + 'chkDB').checked == true)) {
        alert("DB Server Name is required");
        document.getElementById(cntlname + 'txtDBServer').focus();
        document.getElementById(cntlname + 'txtDBServer').style.backgroundColor = "red";
        enableSend = false;
    }

    if ((document.getElementById(cntlname + 'txtDBUser').value == "") && (document.getElementById(cntlname + 'chkDB').checked == true)) {
        alert("User Name is required");
        document.getElementById(cntlname + 'txtDBUser').focus();
        document.getElementById(cntlname + 'txtDBUser').style.backgroundColor = "red";
        enableSend = false;
    }

    if ((document.getElementById(cntlname + 'txtPwrd').value == "") && (document.getElementById(cntlname + 'chkDB').checked == true)) {
        alert("Password is required");
        document.getElementById(cntlname + 'txtPwrd').focus();
        document.getElementById(cntlname + 'txtPwrd').style.backgroundColor = "red";
        enableSend = false;
    }

    if ((document.getElementById(cntlname + 'txtDBName').value == "") && (document.getElementById(cntlname + 'chkDB').checked == true)) {
        alert("DataBase Name is required");
        document.getElementById(cntlname + 'txtDBName').focus();
        document.getElementById(cntlname + 'txtDBName').style.backgroundColor = "red";
        enableSend = false;

    }

    //Email Validation
    if (document.getElementById(cntlname + 'chkEmail').checked == true) {
        if (document.getElementById(cntlname + 'txtSmtpSvr').value == "") {
            alert("SMTP server Name is required");
            document.getElementById(cntlname + 'txtSmtpSvr').focus();
            document.getElementById(cntlname + 'txtSmtpSvr').style.backgroundColor = "red";
            enableSend = false;
        }

        if ((document.getElementById(cntlname + 'txtfrmEmail').value == "") && (document.getElementById(cntlname + 'chkEmail').checked == true)) {
            alert("From Address is required");
            document.getElementById(cntlname + 'txtfrmEmail').focus();
            document.getElementById(cntlname + 'txtfrmEmail').style.backgroundColor = "red";
            enableSend = false;

        }
        if ((document.getElementById(cntlname + 'txtfrmEmail').value) != "") {
            if ((isValidEmail(document.getElementById(cntlname + 'txtfrmEmail').value)) == false) {
                alert("From address email ID is wrong");
                document.getElementById(cntlname + 'txtfrmEmail').focus();
                document.getElementById(cntlname + 'txtfrmEmail').style.backgroundColor = "red";
                enableSend = false;
            }
        }


        if ((document.getElementById(cntlname + 'txtToEmail').value == "") && (document.getElementById(cntlname + 'chkEmail').checked == true)) {
            alert("To Address is required");
            document.getElementById(cntlname + 'txtToEmail').focus();
            document.getElementById(cntlname + 'txtToEmail').style.backgroundColor = "red";
            enableSend = false;

        }
        if ((document.getElementById(cntlname + 'txtToEmail').value != "") && (document.getElementById(cntlname + 'chkEmail').checked == true)) {
            var mailstatus = true;
            mailstatus = SplitCommastrings(document.getElementById(cntlname + 'txtToEmail').value);

            if (mailstatus == false) {
                alert("To address email ID is wrong");
                document.getElementById(cntlname + 'txtToEmail').focus();
                document.getElementById(cntlname + 'txtToEmail').style.backgroundColor = "red";
                enableSend = false;
            }

        }


        //                if ((document.getElementById(cntlname + 'txtSubject').value == "") && (document.getElementById(cntlname + 'chkEmail').checked == true)) {
        //                    alert("Subject is required");
        //                    document.getElementById(cntlname + 'txtSubject').focus();
        //                    document.getElementById(cntlname + 'txtSubject').style.backgroundColor = "red";
        //                    enableSend = false;

        //                }

        //                if ((document.getElementById(cntlname + 'txtBody').value == "") && (document.getElementById(cntlname + 'chkEmail').checked == true)) {
        //                    alert("Body is required");
        //                    document.getElementById(cntlname + 'txtBody').focus();
        //                    document.getElementById(cntlname + 'txtBody').style.backgroundColor = "red";
        //                    enableSend = false;

        //                }
    }

    //Post Build script Validation
    if ((document.getElementById(cntlname + 'txtPostBld').value == "") && (document.getElementById(cntlname + 'chkPstBld').checked == true)) {
        alert("Post Build script Filename is required");
        document.getElementById(cntlname + 'txtPostBld').focus();
        document.getElementById(cntlname + 'txtPostBld').style.backgroundColor = "red";
        enableSend = false;
    }

    if ((document.getElementById(cntlname + 'txtPostCompile').value == "") && (document.getElementById(cntlname + 'chkPstCmp').checked == true)) {
        alert("Post Compile script Filename is required");
        document.getElementById(cntlname + 'txtPostCompile').focus();
        document.getElementById(cntlname + 'txtPostCompile').style.backgroundColor = "red";
        enableSend = false;
    }

    if ((document.getElementById(cntlname + 'txtPostDeploy').value == "") && (document.getElementById(cntlname + 'chkPstDpl').checked == true)) {
        alert("Post Deploy script Filename is required");
        document.getElementById(cntlname + 'txtPostDeploy').focus();
        document.getElementById(cntlname + 'txtPostDeploy').style.backgroundColor = "red";
        enableSend = false;
    }

    //IIS Settings validation

    if ((document.getElementById(cntlname + 'txtWebServerName').value == "") && (document.getElementById(cntlname + 'chkIIS').checked == true)) {
        alert("Web server name is required");
        document.getElementById(cntlname + 'txtWebServerName').focus();
        document.getElementById(cntlname + 'txtWebServerName').style.backgroundColor = "red";
        enableSend = false;
    }
    if ((document.getElementById(cntlname + 'txtAppPoolName').value == "") && (document.getElementById(cntlname + 'chkIIS').checked == true)) {
        alert("Application pool name is required");
        document.getElementById(cntlname + 'txtAppPoolName').focus();
        document.getElementById(cntlname + 'txtAppPoolName').style.backgroundColor = "red";
        enableSend = false;
    }
    if ((document.getElementById(cntlname + 'txtAliasName').value == "") && (document.getElementById(cntlname + 'chkIIS').checked == true)) {
        alert("Virtual directory name is required");
        document.getElementById(cntlname + 'txtAliasName').focus();
        document.getElementById(cntlname + 'txtAliasName').style.backgroundColor = "red";
        enableSend = false;
    }
    if ((document.getElementById(cntlname + 'txtPhysicalLocation').value == "") && (document.getElementById(cntlname + 'chkIIS').checked == true)) {
        alert("Physical location path is required");
        document.getElementById(cntlname + 'txtPhysicalLocation').focus();
        document.getElementById(cntlname + 'txtPhysicalLocation').style.backgroundColor = "red";
        enableSend = false;
    }
    if ((document.getElementById(cntlname + 'txtWebProject').value == "") && (document.getElementById(cntlname + 'chkIIS').checked == true)) {
        alert("Web project path is required");
        document.getElementById(cntlname + 'txtWebProject').focus();
        document.getElementById(cntlname + 'txtWebProject').style.backgroundColor = "red";
        enableSend = false;
    }   

    //Folder path validation section - start       

    if (document.getElementById(cntlname + 'txtTargetPath').value != "") {
        if (FolderPathValidation(document.getElementById(cntlname + 'txtTargetPath').value) == false) {
            alert("Target folder path is wrong");
            document.getElementById(cntlname + 'txtTargetPath').focus();
            document.getElementById(cntlname + 'txtTargetPath').style.backgroundColor = "red";
            enableSend = false;
        }
    }


    if (document.getElementById(cntlname + 'drpTestType').selectedIndex == 0) {
        if (document.getElementById(cntlname + 'txtNunitEXEPath').value != "") {
            if (FolderPathValidation(document.getElementById(cntlname + 'txtNunitEXEPath').value) == false) {
                alert("NUnit BIN folder path is wrong");
                document.getElementById(cntlname + 'txtNunitEXEPath').focus();
                document.getElementById(cntlname + 'txtNunitEXEPath').style.backgroundColor = "red";
                enableSend = false;
            }
        }
    }
    else if (document.getElementById(cntlname + 'drpTestType').selectedIndex == 1) {
        if (document.getElementById(cntlname + 'txtmstextexe').value != "") {
            if (FolderPathValidation(document.getElementById(cntlname + 'txtmstextexe').value) == false) {
                alert("MSTest EXE path path is wrong");
                document.getElementById(cntlname + 'txtmstextexe').focus();
                document.getElementById(cntlname + 'txtmstextexe').style.backgroundColor = "red";
                enableSend = false;
            }
        }
    }

    if (document.getElementById(cntlname + 'txtPhysicalLocation').value != "") {
        if (FolderPathValidation(document.getElementById(cntlname + 'txtPhysicalLocation').value) == false) {
            alert("Physical directory location is wrong");
            document.getElementById(cntlname + 'txtPhysicalLocation').focus();
            document.getElementById(cntlname + 'txtPhysicalLocation').style.backgroundColor = "red";
            enableSend = false;
        }
    }

    if (document.getElementById(cntlname + 'txtBATstorage').value != "") {
        if (FolderPathValidation(document.getElementById(cntlname + 'txtBATstorage').value) == false) {
            alert("BAT storage location is wrong");
            document.getElementById(cntlname + 'txtBATstorage').focus();
            document.getElementById(cntlname + 'txtBATstorage').style.backgroundColor = "red";
            enableSend = false;
        }
    }

    if (document.getElementById(cntlname + 'txtToolpath').value != "") {
        if (FolderPathValidation(document.getElementById(cntlname + 'txtToolpath').value) == false) {
            alert("Absolute path for STSADM tool is wrong");
            document.getElementById(cntlname + 'txtToolpath').focus();
            document.getElementById(cntlname + 'txtToolpath').style.backgroundColor = "red";
            enableSend = false;
        }
    }

    if (document.getElementById(cntlname + 'txtPSEXE').value != "") {
        if (FolderPathValidation(document.getElementById(cntlname + 'txtPSEXE').value) == false) {
            alert("RemCom location is wrong");
            document.getElementById(cntlname + 'txtPSEXE').focus();
            document.getElementById(cntlname + 'txtPSEXE').style.backgroundColor = "red";
            enableSend = false;
        }
    }    
    
    
    //Folder path validation section - end
    

    //Alphabetic validation start


    if (isAlphabet(document.getElementById(cntlname + 'txtBldConfig').value) == false) {
        alert("Build configuration value should be in alphabets");
        document.getElementById(cntlname + 'txtBldConfig').focus();
        document.getElementById(cntlname + 'txtBldConfig').style.backgroundColor = "red";
        enableSend = false;

    }  

    
    //Alphabetic validation end

    //Changed by Yuvaraj Ilangovan
    //numeric validation
    if (IsNumeric(document.getElementById(cntlname + 'txtBldTimeout').value) == false) {
        alert("Build timeout value should be numeric");
        document.getElementById(cntlname + 'txtBldTimeout').focus();
        document.getElementById(cntlname + 'txtBldTimeout').style.backgroundColor = "red";
        enableSend = false;

    }
    if (ddlValue == '0') {
        if (IsNumeric(document.getElementById(cntlname + 'txtTimeOut').value) == false) {
            alert("Timeout value should be numeric");
            document.getElementById(cntlname + 'txtTimeOut').focus();
            document.getElementById(cntlname + 'txtTimeOut').style.backgroundColor = "red";
            return false;
        }
    }
    else if (ddlValue == '2') {
    if (IsNumeric(document.getElementById(cntlname + 'txtCcTimeout').value) == false) {
        alert("Timeout value should be numeric");
        document.getElementById(cntlname + 'txtCcTimeout').focus();
        document.getElementById(cntlname + 'txtCcTimeout').style.backgroundColor = "red";
        return false;
    }
    }

//    if (IsNumeric(document.getElementById(cntlname + 'txtBldIntrvl').value) == false) {
//        alert("Build trigger configuration value should be numeric");
//        document.getElementById(cntlname + 'txtBldIntrvl').focus();
//        document.getElementById(cntlname + 'txtBldIntrvl').style.backgroundColor = "red";
//        enableSend = false;

//    }

    if (IsNumeric(document.getElementById(cntlname + 'txtWaitingTime').value) == false) {
        alert("Check-in waiting time should be numeric");
        document.getElementById(cntlname + 'txtWaitingTime').focus();
        document.getElementById(cntlname + 'txtWaitingTime').style.backgroundColor = "red";
        enableSend = false;
    }
    if (NumericwithAsterik(document.getElementById(cntlname + 'txtMajor').value) == false) {
        alert("Assembly version - Major can be number or * ");
        document.getElementById(cntlname + 'txtMajor').focus();
        document.getElementById(cntlname + 'txtMajor').style.backgroundColor = "red";
        enableSend = false;
    }
    if (NumericwithAsterik(document.getElementById(cntlname + 'txtMinor').value) == false) {
        alert("Assembly version - Minor can be number or *");
        document.getElementById(cntlname + 'txtMinor').focus();
        document.getElementById(cntlname + 'txtMinor').style.backgroundColor = "red";
        enableSend = false;
    }
    if (NumericwithAsterik(document.getElementById(cntlname + 'txtBuildversion').value) == false) {
        alert("Assembly version - Build can be number or *");
        document.getElementById(cntlname + 'txtBuildversion').focus();
        document.getElementById(cntlname + 'txtBuildversion').style.backgroundColor = "red";
        enableSend = false;
    }
    if (NumericwithAsterik(document.getElementById(cntlname + 'txtRevisionversion').value) == false) {
        alert("Assembly version - Revision can be number or *");
        document.getElementById(cntlname + 'txtRevisionversion').focus();
        document.getElementById(cntlname + 'txtRevisionversion').style.backgroundColor = "red";
        enableSend = false;
    }
   

    //email validation

    return enableSend;


}
function Ver_Changed() {

    var cntlname = "ctl00_ContentPlaceHolder1_";

    if (document.getElementById(cntlname + 'chkVersion').checked == true) {

        document.getElementById(cntlname + 'txtMajor').disabled = false;
        document.getElementById(cntlname + 'txtMinor').disabled = false;
        document.getElementById(cntlname + 'txtBuildversion').disabled = false;
        document.getElementById(cntlname + 'txtRevisionversion').disabled = false;
    }
    else {
        document.getElementById(cntlname + 'txtMajor').disabled = true;
        document.getElementById(cntlname + 'txtMinor').disabled = true;
        document.getElementById(cntlname + 'txtBuildversion').disabled = true;
        document.getElementById(cntlname + 'txtRevisionversion').disabled = true;
    }

}

function chkPreBuild_Changed() {

    var cntlname = "ctl00_ContentPlaceHolder1_";
    if (document.getElementById(cntlname + 'chkPreBuild').checked == true) {
        document.getElementById("ctl00_ContentPlaceHolder1_pnlPreBld").disabled = false;

    }
    else {
        document.getElementById("ctl00_ContentPlaceHolder1_pnlPreBld").disabled = true;
    }
}




function ChkBldTrger_Changed() {
    var cntlname = "ctl00_ContentPlaceHolder1_";
    if (document.getElementById(cntlname + 'ChkBldTrger').checked == true) {
        document.getElementById("ctl00_ContentPlaceHolder1_pnlBldTrigger").disabled = false;
    }
    else
        document.getElementById("ctl00_ContentPlaceHolder1_pnlBldTrigger").disabled = true;


}

function chkStyleCop_Changed() {

    var cntlname = "ctl00_ContentPlaceHolder1_";
    if (document.getElementById(cntlname + 'chkStyleCop').checked == true) {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlstyleCop").disabled = false;

    }
    else {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlstyleCop").disabled = true;
    }


}

function chkNunit_Changed() {

    var cntlname = "ctl00_ContentPlaceHolder1_";
    if (document.getElementById(cntlname + 'chkNunit').checked == true) {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlNunit").disabled = false;

    }
    else {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlNunit").disabled = true;
    }


}

function chkNcover_Changed() {

    var cntlname = "ctl00_ContentPlaceHolder1_";
    if (document.getElementById(cntlname + 'chkNcover').checked == true) {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlNcover").disabled = false;
    }
    else {
        document.getElementById(cntlname + 'txtNCReport').disabled = true;
        document.getElementById("ctl00_ContentPlaceHolder1_PnlNcover").disabled = true;
    }

}
function ChkFx_Changed() {

    var cntlname = "ctl00_ContentPlaceHolder1_";
    if (document.getElementById(cntlname + 'ChkFx').checked == true) {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlFxCop").disabled = false;
    }
    else {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlFxCop").disabled = true;
    }

}
function ChkSand_Changed() {

    var cntlname = "ctl00_ContentPlaceHolder1_";
    if (document.getElementById(cntlname + 'ChkSand').checked == true) {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlSand").disabled = false;
    }
    else {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlSand").disabled = true;
    }
}
function chkND_Changed() {

    var cntlname = "ctl00_ContentPlaceHolder1_";
    if (document.getElementById(cntlname + 'chkND').checked == true) {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlND").disabled = false;
    }
    else {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlND").disabled = true;
    }

}

function chkDB_Changed() {

    var cntlname = "ctl00_ContentPlaceHolder1_";
    if (document.getElementById(cntlname + 'chkDB').checked == true) {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlDB").disabled = false;
    }
    else {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlDB").disabled = true;
    }

}


function chkEmail_Changed() {

    var cntlname = "ctl00_ContentPlaceHolder1_";

    if (document.getElementById(cntlname + 'chkEmail').checked == true) {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlEmail").disabled = false;
    }

    else {
        document.getElementById("ctl00_ContentPlaceHolder1_PnlEmail").disabled = true;

    }


}

function chkPstBld_Changed() {

    var cntlname = "ctl00_ContentPlaceHolder1_";
    if (document.getElementById(cntlname + 'chkPstBld').checked == true) {
        document.getElementById("ctl00_ContentPlaceHolder1_pnlPstBld").disabled = false;

    }
    else {
        document.getElementById("ctl00_ContentPlaceHolder1_pnlPstBld").disabled = true;
    }
}



//Numeric Validation script
function IsNumeric(sText) {


    var ValidChars = "0123456789.";
    var IsNumber = true;
    var Char;


    for (i = 0; i < sText.length && IsNumber == true; i++) {
        Char = sText.charAt(i);
        if (ValidChars.indexOf(Char) == -1) {
            IsNumber = false;
        }
    }
    if (!IsNumber) {        
        return false;
    }
    else {
        return true;
    }
}

//Special characters validation
function IsSpecialChar(sText) {

    var iChars = "^!@#$/|\:<>?";

    for (var i = 0; i < sText.length; i++) {
        if (iChars.indexOf(sText.charAt(i)) != -1) {
            alert("special characters like ^!@#$/|\:<>? are Found. \nThese are not allowed.\n Please remove them and try again.");
            return false;
        }
    }

}

//Alphabet validation

function isAlphabet(text) {
    for (c = 0; c < text.length; c++) {
        alpha = (text.charCodeAt(c) >= 65 &&
         text.charCodeAt(c) <= 90) ||
         (text.charCodeAt(c) >= 97 &&
         text.charCodeAt(c) <= 122)
        if (!alpha) {
            return false;
        }
    }
    return true;
}

//Numeric with special characters

function NumericwithAsterik(text) {    
    var valid = "0123456789*";
    for (var i = 0; i < valid.length; i++) {
        if (valid.indexOf(text.charAt(i)) < 0) {           
            return false;
        }
    }
}

   




//Email entry validation
function EmailValidation(sText) {

    if (sText > 0) {
        i = sText.indexOf("@")
        j = sText.indexOf(".", i)
        k = sText.indexOf(",")
        kk = sText.indexOf(" ")
        jj = sText.lastIndexOf(".") + 1
        len = sText.length

        if ((i > 0) && (j > (1 + 1)) && (k == -1) && (kk == -1) && (len - jj >= 2) && (len - jj <= 3)) {
        }
        else {
            alert("Please enter an exact email address.\n" + sText + " is invalid.");
            return false;
        }

    }
}

function openwindow(sText, sTitle) {
    w = open('', 'windowname', 'width=400,height=200,left=450,top=300');
    with (w.document) {
        write('<body style="background-color:EEEEEE;text-align:left; font: 13px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif";>');
        write('<title>');
        write(sTitle);
        write('</title>');
        write(sText);
        write("</body>");
    }
    return false;
}

function isValidEmail(email) {

    if (email == null) {
        if (required) {
            return false;
        }
        return true;
    }

    if (email.length == 0) {
        {
            return false;
        }
        return true;
    }

    if (email.indexOf("@") < 0) { //  must contain @, and it must not be the first character
        //alert("Not a valid email address, @ symbol not found");
        return false;

    } else if (email.indexOf("@") == 0) { //  must contain @, and it must not be the first character
        //alert("Not a valid email address, @ symbol not found");
        return false;

    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @
        //alert("Not a valid email addressm, last dot is not found");
        return false;

    } else if (email.indexOf("@") == email.length) {  // @ must not be the last character
        //alert("Not a valid email address, @ must not be the last character");
        return false;
    } else if (email.indexOf("..") >= 0) { // two periods in a row is not valid
        //alert("Not a valid email address");
        return false;
    } else if (email.indexOf(".") == (email.length - 1)) {  // . must not be the last character
        //alert("Not a valid email address, dot must not be the last letter");
        return false;
    } else if (email.indexOf("@") == (email.indexOf(".") - 1)) {  // . must not be the last character
        //alert("Not a valid email address, Domain name required");
        return false;
    }
    return true;
}

function SplitCommastrings(sText) {
    var emailstatus = true;
    var mySplitResult = sText.split(";");
    for (i = 0; i < mySplitResult.length - 1; i++) {
        if (emailstatus == true) {
            emailstatus = isValidEmail(mySplitResult[i]);
        }
    }
    return emailstatus;
}


// Script for Expand / Collapse sections - START

function doToggleCongStng() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpextndvCCConfig";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgConfigSetting', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgConfigSetting', 'images/Expand.gif');
    }
}

function doToggleSrcCtrlCongStng() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexpnlSrcCtrlConfig";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgSrcConfigStng', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgSrcConfigStng', 'images/Expand.gif');
    }
}


function doTogglePreBuild() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexpnlPreBld";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgSrcpreBuild', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgSrcpreBuild', 'images/Expand.gif');
    }
}
function doTogglepnlBldTrigger() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexpnlBldTrigger";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgSrcBuildTrigger', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgSrcBuildTrigger', 'images/Expand.gif');
    }
}
function doTogglePnlstyleCop() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexPnlstyleCop";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgSrcStyleCop', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgSrcStyleCop', 'images/Expand.gif');
    }
}
function doTogglePnlNunit() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexPnlNunit";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgSrcNunit', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgSrcNunit', 'images/Expand.gif');
    }
}

function doTogglePnlScimitar() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexPnlFunctional";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgScimitar', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgScimitar', 'images/Expand.gif');
    }
}

function doTogglePnlNcover() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexPnlNcover";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgSrcNcover', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgSrcNcover', 'images/Expand.gif');
    }
}
function doTogglePnlFxCop() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexPnlFxCop";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgSrcFxcop', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgSrcFxcop', 'images/Expand.gif');
    }
}

function doTogglePnlCATNET() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexPnlCATNET";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgCATNET', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgCATNET', 'images/Expand.gif');
    }
}

function doTogglePnlSand() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexPnlSand";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgSrcSandCastle', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgSrcSandCastle', 'images/Expand.gif');
    }
}

function doTogglePnlND() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexPnlND";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgSrcNdepend', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgSrcNdepend', 'images/Expand.gif');
    }
}

function doTogglePnlDB() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexPnlDB";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgSrcDatabase', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgSrcDatabase', 'images/Expand.gif');
    }
}

function doTogglePnlEmail() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexPnlEmail";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgSrcEmail', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgSrcEmail', 'images/Expand.gif');
    }
}

function doTogglePnlPstBld() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexpnlPstBld";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgSrcPostBuild', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgSrcPostBuild', 'images/Expand.gif');
    }
}

function doTogglePnlIIS() {
    var ctrlName = "ctl00_ContentPlaceHolder1_clpexpnlIIS";
    var cpecconfig = $find(ctrlName);
    //cpe._toggle();
    if (cpecconfig.get_Collapsed()) {
        cpecconfig._doOpen();
        changeimage('imgIIS', 'images/Collapse.gif');

    } else {
        cpecconfig._doClose();
        changeimage('imgIIS', 'images/Expand.gif');
    }
}



function doExpandAll() {
    // Assign collapsible panel control names in proper variables.

    var pnlCConfig = "ctl00_ContentPlaceHolder1_clpextndvCCConfig";
    var pnlSrcCtrlConfig = "ctl00_ContentPlaceHolder1_clpexpnlSrcCtrlConfig";
    var pnlPreBld = "ctl00_ContentPlaceHolder1_clpexpnlPreBld";
    var pnlBldTrg = "ctl00_ContentPlaceHolder1_clpexpnlBldTrigger";
    var pnlstyleCop = "ctl00_ContentPlaceHolder1_clpexPnlstyleCop";
    var pnlNunit = "ctl00_ContentPlaceHolder1_clpexPnlNunit";
    var pnlFunctional = "ctl00_ContentPlaceHolder1_clpexPnlFunctional";
    var pnlNcover = "ctl00_ContentPlaceHolder1_clpexPnlNcover";
    var pnlFxCop = "ctl00_ContentPlaceHolder1_clpexPnlFxCop";
    var pnlCATNET = "ctl00_ContentPlaceHolder1_clpexPnlCATNET";
    var pnlSand = "ctl00_ContentPlaceHolder1_clpexPnlSand";
    var pnlND = "ctl00_ContentPlaceHolder1_clpexPnlND";
    var pnlDB = "ctl00_ContentPlaceHolder1_clpexPnlDB";
    var pnlEmail = "ctl00_ContentPlaceHolder1_clpexPnlEmail";
    var pnlPstBld = "ctl00_ContentPlaceHolder1_clpexpnlPstBld";
    var pnlIIS = "ctl00_ContentPlaceHolder1_clpexpnlIIS";
    
    // Find collapsible control names in the form and assign into variables.

    var cpecCConfig = $find(pnlCConfig);
    var cpecSrcCtrlConfig = $find(pnlSrcCtrlConfig);
    var cpecPreBld = $find(pnlPreBld);
    var cpecBldTrigger = $find(pnlBldTrg);
    var cpecstyleCop = $find(pnlstyleCop);
    var cpecNunit = $find(pnlNunit);
    var cpecFunctional = $find(pnlFunctional);
    var cpecNcover = $find(pnlNcover);
    var cpecFxCop = $find(pnlFxCop);
    var cpecCATNET = $find(pnlCATNET);
    var cpecSand = $find(pnlSand);
    var cpecND = $find(pnlND);
    var cpecDB = $find(pnlDB);
    var cpecEmail = $find(pnlEmail);
    var cpecPstBld = $find(pnlPstBld);
    var cpecIIS = $find(pnlIIS);
    

    if (cpecCConfig.get_Collapsed()) {
        cpecCConfig._doOpen();
        changeimage('imgConfigSetting', 'images/Collapse.gif');
    }

    if (cpecSrcCtrlConfig.get_Collapsed()) {
        cpecSrcCtrlConfig._doOpen();
        changeimage('imgSrcConfigStng', 'images/Collapse.gif');
    }
    if (cpecPreBld.get_Collapsed()) {
        cpecPreBld._doOpen();
        changeimage('imgSrcpreBuild', 'images/Collapse.gif');
    }
    if (cpecBldTrigger.get_Collapsed()) {
        cpecBldTrigger._doOpen();
        changeimage('imgSrcBuildTrigger', 'images/Collapse.gif');
    }
    if (cpecstyleCop.get_Collapsed()) {
        cpecstyleCop._doOpen();
        changeimage('imgSrcStyleCop', 'images/Collapse.gif');
    }
    if (cpecNunit.get_Collapsed()) {
        cpecNunit._doOpen();
        changeimage('imgSrcNunit', 'images/Collapse.gif');
    }
    if (cpecFunctional.get_Collapsed()) {
        cpecFunctional._doOpen();
        changeimage('imgScimitar', 'images/Collapse.gif');
    }   
    
    if (cpecNcover.get_Collapsed()) {
        cpecNcover._doOpen();
        changeimage('imgSrcNcover', 'images/Collapse.gif');
    }
    if (cpecFxCop.get_Collapsed()) {
        cpecFxCop._doOpen();
        changeimage('imgSrcFxcop', 'images/Collapse.gif');
    }

    if (cpecCATNET.get_Collapsed()) {
        cpecCATNET._doOpen();
        changeimage('imgCATNET', 'images/Collapse.gif');
    }
    
    if (cpecSand.get_Collapsed()) {
        cpecSand._doOpen();
        changeimage('imgSrcSandCastle', 'images/Collapse.gif');
    }
    if (cpecND.get_Collapsed()) {
        cpecND._doOpen();
        changeimage('imgSrcNdepend', 'images/Collapse.gif');
    }
    if (cpecDB.get_Collapsed()) {
        cpecDB._doOpen();
        changeimage('imgSrcDatabase', 'images/Collapse.gif');
    }
    if (cpecEmail.get_Collapsed()) {
        cpecEmail._doOpen();
        changeimage('imgSrcEmail', 'images/Collapse.gif');
    }
    if (cpecPstBld.get_Collapsed()) {
        cpecPstBld._doOpen();
        changeimage('imgSrcPostBuild', 'images/Collapse.gif');
    }
    if (cpecIIS.get_Collapsed()) {
        cpecIIS._doOpen();
        changeimage('imgIIS', 'images/Collapse.gif');
    }
    

}

function doCollapseAll() {
    // Assign collapsible panel control names in proper variables.

    var pnlCConfig = "ctl00_ContentPlaceHolder1_clpextndvCCConfig";
    var pnlSrcCtrlConfig = "ctl00_ContentPlaceHolder1_clpexpnlSrcCtrlConfig";
    var pnlPreBld = "ctl00_ContentPlaceHolder1_clpexpnlPreBld";
    var pnlBldTrg = "ctl00_ContentPlaceHolder1_clpexpnlBldTrigger";
    var pnlstyleCop = "ctl00_ContentPlaceHolder1_clpexPnlstyleCop";
    var pnlNunit = "ctl00_ContentPlaceHolder1_clpexPnlNunit";
    var pnlFunctional = "ctl00_ContentPlaceHolder1_clpexPnlFunctional";
    var pnlNcover = "ctl00_ContentPlaceHolder1_clpexPnlNcover";
    var pnlFxCop = "ctl00_ContentPlaceHolder1_clpexPnlFxCop";
    var pnlCATNET = "ctl00_ContentPlaceHolder1_clpexPnlCATNET";
    var pnlSand = "ctl00_ContentPlaceHolder1_clpexPnlSand";
    var pnlND = "ctl00_ContentPlaceHolder1_clpexPnlND";
    var pnlDB = "ctl00_ContentPlaceHolder1_clpexPnlDB";
    var pnlEmail = "ctl00_ContentPlaceHolder1_clpexPnlEmail";
    var pnlPstBld = "ctl00_ContentPlaceHolder1_clpexpnlPstBld";
    var pnlIIS = "ctl00_ContentPlaceHolder1_clpexpnlIIS";
    

    // Find collapsible control names in the form and assign into variables.

    var cpecCConfig = $find(pnlCConfig);
    var cpecSrcCtrlConfig = $find(pnlSrcCtrlConfig);
    var cpecPreBld = $find(pnlPreBld);
    var cpecBldTrigger = $find(pnlBldTrg);
    var cpecstyleCop = $find(pnlstyleCop);
    var cpecNunit = $find(pnlNunit);
    var cpecFunctional = $find(pnlFunctional);
    var cpecNcover = $find(pnlNcover);
    var cpecFxCop = $find(pnlFxCop);
    var cpecCATNET = $find(pnlCATNET);
    var cpecSand = $find(pnlSand);
    var cpecND = $find(pnlND);
    var cpecDB = $find(pnlDB);
    var cpecEmail = $find(pnlEmail);
    var cpecPstBld = $find(pnlPstBld);
    var cpecIIS = $find(pnlIIS);
    

    if (!cpecCConfig.get_Collapsed()) {
        cpecCConfig._doClose();
        changeimage('imgConfigSetting', 'images/Expand.gif');
    }
    if (!cpecSrcCtrlConfig.get_Collapsed()) {
        cpecSrcCtrlConfig._doClose();
        changeimage('imgSrcConfigStng', 'images/Expand.gif');
    }

    if (!cpecPreBld.get_Collapsed()) {
        cpecPreBld._doClose();
        changeimage('imgSrcpreBuild', 'images/Expand.gif');
    }
    if (!cpecBldTrigger.get_Collapsed()) {
        cpecBldTrigger._doClose();
        changeimage('imgSrcBuildTrigger', 'images/Expand.gif');
    }
    if (!cpecstyleCop.get_Collapsed()) {
        cpecstyleCop._doClose();
        changeimage('imgSrcStyleCop', 'images/Expand.gif');
    }
    if (!cpecNunit.get_Collapsed()) {
        cpecNunit._doClose();
        changeimage('imgSrcNunit', 'images/Expand.gif');
    }

    if (!cpecFunctional.get_Collapsed()) {
        cpecFunctional._doClose();
        changeimage('imgScimitar', 'images/Expand.gif');
    }
    
    if (!cpecNcover.get_Collapsed()) {
        cpecNcover._doClose();
        changeimage('imgSrcNcover', 'images/Expand.gif');
    }
    if (!cpecFxCop.get_Collapsed()) {
        cpecFxCop._doClose();
        changeimage('imgSrcFxcop', 'images/Expand.gif');
    }

    if (!cpecCATNET.get_Collapsed()) {
        cpecCATNET._doClose();
        changeimage('imgCATNET', 'images/Expand.gif');
    }    
    if (!cpecSand.get_Collapsed()) {
        cpecSand._doClose();
        changeimage('imgSrcSandCastle', 'images/Expand.gif');
    }
    if (!cpecND.get_Collapsed()) {
        cpecND._doClose();
        changeimage('imgSrcNdepend', 'images/Expand.gif');
    }
    if (!cpecDB.get_Collapsed()) {
        cpecDB._doClose();
        changeimage('imgSrcDatabase', 'images/Expand.gif');
    }
    if (!cpecEmail.get_Collapsed()) {
        cpecEmail._doClose();
        changeimage('imgSrcEmail', 'images/Expand.gif');
    }
    if (!cpecPstBld.get_Collapsed()) {
        cpecPstBld._doClose();
        changeimage('imgSrcPostBuild', 'images/Expand.gif');
    }
    if (!cpecIIS.get_Collapsed()) {
        cpecIIS._doClose();
        changeimage('imgIIS', 'images/Expand.gif');
    }
    
}
function changeimage(ctrl_name, img_src) {
    document.getElementById(ctrl_name).src = img_src;
}


// Script for Expand / Collapse sections - END

//Time validation start

function checktime(thetime) {    
    var a, b, c, f, err = 0;
    //a = thetime.value;
    a = thetime;
    if (a.length != 5) err = 1;
    b = a.substring(0, 2);
    c = a.substring(2, 3);
    f = a.substring(3, 5);
    if (/\D/g.test(b)) err = 1; //not a number
    if (/\D/g.test(f)) err = 1;
    if (b < 0 || b > 23) err = 1;
    if (f < 0 || f > 59) err = 1;
    if (c != ':') err = 1;
    if (err == 1) {
        return false;
    }
    else {
        return true;
    }
}

//Time validation end  


// Script for validating directory path entries - START

function FolderPathValidation(path) {

    if (path != "") {
        var arr = path.split("\\");
        var i = 1;
        if (arr.length > 0) {
            for (i = 1; i < arr.length; i++) {
                if (arr[i].charAt(arr[i].indexOf('*')).match(/^[*]/) || arr[i].charAt(arr[i].indexOf('?')).match(/^[?]/) || arr[i].charAt(arr[i].indexOf('"')).match(/^[\""]/) || arr[i].charAt(arr[i].indexOf('<')).match(/^[<]/) || arr[i].charAt(arr[i].indexOf('>')).match(/^[>]/) || arr[i].charAt(arr[i].indexOf('|')).match(/^[|]/)) {
                    return false;
                }
            }
        }

        var pos = path.indexOf("\\");
        var j = 0;
        var arr1 = new Array();
        while(pos > -1)
        {
            arr1.push(pos);            
            pos = path.indexOf("\\", pos + 1);
        }
        for (j = 0; j < arr1.length; j++) {
            //alert(arr1[j]);
            if (path.charAt(arr1[j] + 1) == "\\") {
                return false;
            }
        }
        
        if ((path.charAt(0) != "\\" && path.charAt(1) != "\\") && (path.charAt(0) != "/" && path.charAt(1) != "/") && (path.charAt(2) != "/")) {

            if (!path.charAt(0).match(/^[a-zA-z]/)) {
                //alert("Enter Valid location");

                return false;
            }

            if (path.charAt(1) == "" || !path.charAt(1).match(/^[:]/) || !path.charAt(2).match(/^[\/\\]/)) {
                //alert("Enter Valid location");

                return false;
            }
            else {
                //alert("Entered location " + path + " is correct");	
                return true;
            }
        }
        else {
            return false;
        }

    }    
}

// Script for validating directory path entries - END

//URL validation start
function isUrl(url) {
    var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/    
    return regexp.test(url);
}



//URL validation end


                  

            

        

